<template>
	<view class="container">
		<!-- TODO 编写结构代码 , 图标来自于本地资源-->
		<uni-list>
			<uni-list-item v-for="(item) in list" :key="" :title="item.name"
				thumb="../../static/head.png"></uni-list-item>
		</uni-list>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				// TODO 定义页面数据结构
				"list": [{
						"id": 6,
						"major": "移动应用开发",
						"department": "信息工程学院",
						"name": "张三",
						"phone": "15116785432",
						"email": "zs@163.com"
					}

				]
			}
		},
		onLoad() {
			// TODO 定义页面逻辑代码，获取网络中的数据，更新页面数据结构this.list = res.data.list
			uni.request({
				url: 'http://127.0.0.1:8090/app3/classmate/list',
				method: 'POST',
				data: {},
				success: res => {
					if (res.data.success) {
						this.list = res.data.list
						uni.showToast({
							title: '成功',
							icon: 'none'
						});
					} else {
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					}
				},
				fail: () => {
					uni.showToast({
						title: '网络错误',
						icon: 'none'
					});
				},
				complete: () => {}
			});
		},
		methods: {

		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>